<template>
	<view class="u-p-l-10 u-p-r-10">
		<view>
			<!-- 2.0.19支持autoBack，默认为false -->
			<u-navbar :title="title" @rightClick="rightClick" :autoBack="true" bgColor="#aa0000">
			</u-navbar>
		</view>
		<view>
			<u-form :model="form" ref="uForm" label-width="150">
				<u-form-item label="诉求主题"><u-input v-model="form.name" /></u-form-item>
				<u-form-item label="诉求内容"><u-input v-model="form.intro" /></u-form-item>
				<u-form-item label="您的姓名"><u-input v-model="form.intro" /></u-form-item>
				<u-form-item label="手机号"><u-input v-model="form.intro" /></u-form-item>
				<u-form-item label="诉求类型">
					<u-input v-model="form.type" type="select" @click="typeShow = true" />
				</u-form-item>
				<u-form-item label="是否公开">
					<u-checkbox-group>
						<u-checkbox v-model="item.checked" v-for="(item, index) in checkboxList" :key="index"
							:name="item.name">
							{{ item.name }}
						</u-checkbox>
					</u-checkbox-group>
				</u-form-item>

				<u-form-item label="接收部门">
					<u-input v-model="form.section" type="select" @click="sectionShow = true" />
				</u-form-item>

				<u-form-item label="上传图片">
					<u-upload :action="action" :file-list="fileList"></u-upload>
				</u-form-item>
			</u-form>
			<u-action-sheet :tips="typeTips" :list="typeList" v-model="typeShow"
				@click="typeActionSheetCallback"></u-action-sheet>
				<u-action-sheet :tips="sectionTips" :list="sectionList" v-model="sectionShow"
					@click="sectionActionSheetCallback"></u-action-sheet>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title:'',
				typeShow: false,
				sectionShow: false,
				swiperList: [{
						image: 'https://img-u-3.51miz.com/preview/muban/00/00/58/68/M-586833-C032DFF8.jpg',
						title: '身无彩凤双飞翼，心有灵犀一点通'
					},
					{
						image: 'https://ts1.cn.mm.bing.net/th/id/R-C.28c73d9fca11fd7423b21e282c541e26?rik=bHXZkcjWxOGYsA&riu=http%3a%2f%2fimg.aiimg.com%2fuploads%2fallimg%2f220220%2f263915-220220111H0.jpg&ehk=LiOMe7vgY3xS77DbmVyOXcjYtgzid4qqJLK1yeJWQFA%3d&risl=&pid=ImgRaw&r=0',
						title: '身通'
					},
				],
				form: {
					name: '',
					intro: '',
					sex: '',
					type: '',
					section: ''
				},
				typeTips: {
					text: '请选择类型',
					color: '#909399',
					fontSize: 24
				},
				sectionTips: {
					text: '请选择接收部门',
					color: '#909399',
					fontSize: 24
				},
				typeList: [{
						text: '其他'
					},
					{
						text: '教育教学'
					},
					{
						text: '公安消防'
					}
				],
				sectionList: [{
						text: '县纪委'
					},
					{
						text: '组织部'
					},
					{
						text: '法院'
					}
				],

				checkboxList: [{
						name: '公开',
						checked: false,
						disabled: false
					},
					{
						name: '不公开',
						checked: false,
						disabled: false
					},
				],
				switchVal: false
			};
		},
		onLoad(option) {
			console.log(option)
			this.title = option.title
		},
		methods: {
			confirm(e) {
				console.log(e);
			},

			typeActionSheetCallback(index) {
				console.log(index,"1e21")
				uni.hideKeyboard();
				this.form.type = this.typeList[index].text;
			},
			sectionActionSheetCallback(index) {
				uni.hideKeyboard();
				this.form.section = this.sectionList[index].text;
			},

		}
	};
</script>